from django.shortcuts import render
from django.http import HttpResponse
from django.views import View

# Create your views here.
def index(request,*args,**kwargs):
    return HttpResponse('index')

class IndexView(View):
    def get(self,request,*args,**kwargs):
        return HttpResponse("index view!")

def login(request,*args,**kwargs):
    if request.method == "GET":
        return HttpResponse("登录页面")
    elif request.method == "POST":
        return HttpResponse("验证功能")
    else:
        pass
    return HttpResponse("")

class LoginView(View):
    def get(self,request,*args,**kwargs):
        return HttpResponse("登录页面")
    def post(self,request,*args,**kwargs):
        return HttpResponse("验证功能")

def user(request,*args,**kwargs):
    return HttpResponse("")

class UserView(View):
    http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace','list']
    def get(self,request,*args,**kwargs):
        return HttpResponse("用户信息")
    def post(self,request,*args,**kwargs):
        return HttpResponse("修改用户信息")
    def delete(self,request,*args,**kwargs):
        return HttpResponse("删除用户信息")
    def put(self,request,*args,**kwargs):
        return HttpResponse("新增用户信息")
    def list(self,request,*args,**kwargs):
        return HttpResponse("获取用户列表")
